﻿using UnityEngine;

public class PlayerFSM : BaseFSMCtrl<PlayerCtrl> {
	public IdleState IdleState;
	public MoveState MoveState;
	public DeadState DeadState;

	public override void InitFSM(PlayerCtrl ctrl) {
		IdleState = gameObject.TryGetComponent<IdleState>();
		MoveState = gameObject.TryGetComponent<MoveState>();
		DeadState = gameObject.TryGetComponent<DeadState>();

		IdleState.Init(ctrl);
		MoveState.Init(ctrl);
		DeadState.Init(ctrl);

		FSM = new FSMMachine(IdleState);
		base.Init();
	}

	public void OnIdle() {
		ProccessState(IdleState);
	}

	public void OnMove() {
		ProccessState(MoveState);
	}

	public void OnDie()
	{
		ProccessState(DeadState);
	}
}
